package io.github.iogogogo.hippo.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

import java.lang.reflect.Type;

/**
 * Created by tao.zeng on 2021/11/9.
 */
public interface JsonParse {

    static <T> T parse(String json, Class<T> clz) {
        return JSON.parseObject(json, clz);
    }

    static <T> T parse(String json, Type type) {
        return JSON.parseObject(json, type);
    }

    static String toJson(Object data, SerializerFeature... features) {
        return JSON.toJSONString(data, features);
    }
}
